#include <bits/stdc++.h>
using namespace std;
const int N = 140005;
int n, m, a[N], V, X[4];
bool Q[N], c[N << 1];
char s[N];
signed main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
		scanf("%d", a + i);
	for (int i = 1, v; i <= m; i++) {
		scanf("%d", &v);
		Q[v] = true;
	}
	int D = ceil(log2(n));
	for (int i = 1; i <= D; i++) {
		scanf("%s", s);
		for (int j = 1 << (D - i); j < 1 << (D - i + 1); j++)
			c[j] = s[j - (1 << (D - i))] - '0';
	}
	V = (1 << D) - 1;
	while (t--) {
		scanf("%d%d%d%d", X + 0, X + 1, X + 2, X + 3);
		for (int i = 1; i <= n; i++)
			a[i] ^= X[i % 4];
		for (int i = 1; i <= n; i++) {
			int cur = i + V;
			while (cur > 1) {
				int fa = cur >> 1;
				if (c[fa]) { // depend on right son
					if (cur % 2) {
						// right son
						// Ah noooo I don't have enough time for this...
					}
				}
			}
		}
		for (int i = 1; i <= n; i++)
			a[i] ^= X[i % 4];
	}
	return 0;
}